import * as actionTypes from './actionTypes'
import { Route as StoreRoute } from '@/model/store/route'
const route: StoreRoute = {
  routeList: [],
  currentPath: '',
  menus: [],
  delPath: ''
}

export default function reducer(
  state = route,
  action: any
) {
  const { type, routeList, currentPath, menus, delPath } =
    action

  switch (type) {
    case actionTypes.ROUTE_LIST:
      return { ...state, routeList }
    case actionTypes.CURRENT_PATH:
      return { ...state, currentPath }
    case actionTypes.MENUS:
      return { ...state, menus }
    case actionTypes.DEL_PATH:
      return { ...state, delPath }
  }
  return state
}
